<template>
  <div class="info_wrap">
    <h3>{{ artistname }}简介</h3>
    <div>{{ artistInfo.briefDesc }}</div>

    <div v-for="(item, index) in artistInfo.introduction" :key="index">
      <h3>{{ item.ti }}</h3>
      <ul class="info">
        <li v-for="txt in formateText(item.txt)" :key="txt">
          {{ txt }}
        </li>
      </ul>
    </div>
  </div>
</template>
<script>
import { _getArtistDescDetail } from '../../../network/aritist'

export default {
  props: ['id', 'artistname'],
  data () {
    return {
      artistInfo: {}
    }
  },
  created () {
    this.getDesc()
  },
  methods: {
    formateText (txt) {
      let newText = txt.split('\n')
      return newText
    },
    async getDesc () {
      // 获取歌手描述
      var res = await _getArtistDescDetail(this.id)
      console.log('---------', res)
      this.artistInfo = res.data
      // 兄弟传参
      this.$bus.$emit('senddesc', res.data.briefDesc)
    }
  },
  watch: {
    id () {
      this.getDesc()
    }
  }
}
</script>
<style lang="less">
.info_wrap {
  h3 {
    margin-top: 10px;
  }
  .info {
    li {
      list-style-position: inside;
      list-style-type: disc;
      margin-top: 10px;
      font-size: 18px;
    }
  }
}
</style>
